package cn.whuc.scala.collections

object Generate {
  def main(args: Array[String]): Unit = {
    // 数组
    val ints: Array[Int] = new Array[Int](2)
    for (elem <- ints) {
//      println(elem)
    }
    val ints1: Array[Int] = Array(1, 2, 3, 4, 5)
    for (elem <- ints1) {
//      println(elem)
    }
    val ints2: Array[Int] = Array.apply(1, 2, 3)
    for (elem <- ints2) {
//      println(elem)
    }

    // 序列seq
    val list1: List[Int] = List(1, 2, 3, 4)

    val list2: List[Int] = list1 :+ 1
    for (elem <- list2) {
      println(elem)
    }
    val list3: List[Int] = 1 +: list1
    for (elem <- list3) {
      println(elem)
    }

  }
}
